<layout name="layout" />
<div class="form-div">
    <form action="__ACTION__" method="get" name="searchForm">
        <p>
            商品名称：&nbsp;&nbsp;&nbsp;
            <input type="text" name="gn" value="<?php echo I('get.gn')?>" size="34" />
        </p>
        <p>
            商品品牌：&nbsp;&nbsp;&nbsp;
            <?php buildSelect('brand','brand_id','id','brand_name',I('get.brand_id')); ?>
        </p>
        <p>
            价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格：
            从<input type="text" name="fp" value="<?php echo I('get.fp')?>" size="15" />
            到 <input type="text" name="tp" value="<?php echo I('get.tp')?>" size="15" />
        </p>
        <p>
            是否上架：
            <?php $ios = I('get.ios'); ?>
            <input type="radio" name="ios" value="" <?php if($ios == '') echo 'checked="checked"' ?> />全部
            <input type="radio" name="ios" value="是" <?php if($ios=='是') echo 'checked="checked"'?> />上架
            <input type="radio" name="ios" value="否" <?php if($ios=='否') echo 'checked="checked"'?> />下架
        </p>
        <p>
            添加时间：
            从<input id="fa" type="text" name="fa" value="<?php echo I('get.fa')?>" size="19" />
            到 <input id="ta" type="text" name="ta" value="<?php echo I('get.ta')?>" size="19" />
        </p>
        <p>
            排序：
            <?php $odby = I('get.odby','id_desc');   //如果odby为空，那么默认是id_desc?>
            <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="id_desc" <?php if($odby == 'id_desc') echo 'checked="checked"' ?> />添加时间降序
            <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="id_asc" <?php if($odby == 'id_asc') echo 'checked="checked"' ?> />添加时间升序
            <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="price_desc" <?php if($odby == 'price_desc') echo 'checked="checked"' ?> />价格降序
            <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="price_asc" <?php if($odby == 'price_asc') echo 'checked="checked"' ?> />价格升序
        </p>
        <p>
            <input type="submit" value="搜索" />
        </p>
    </form>
</div>

<!-- 商品列表 -->
<form method="post" action="" name="listForm" onsubmit="">
    <div class="list-div" id="listDiv">
        <table cellpadding="3" cellspacing="1">
            <tr>
                <th>编号</th>
                <th>品牌</th>
                <th>商品名称</th>
                <th>LOGO</th>
                <th>市场价格</th>
                <th>本店价格</th>
                <th>上架</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            <?php foreach($data as $k => $v):?>
            <tr class="tron">
                <td align="center"><?php echo $v['id']?></td>
                <td align="center"><?php showImage($v['logo'],50)?></td>
                <td align="center" class="first-cell"><span><?php echo $v['goods_name']?></span></td>
                <td align="center"><?php showImage($v['sm_logo']); ?></td>
                <td align="center"><?php echo $v['market_price']?></td>
                <td align="center"><?php echo $v['shop_price']?></td>
                <td align="center"><?php echo $v['is_on_sale']?></td>
                <td align="center"><?php echo $v['addtime']?></td>
                <td align="center">
                    <a href="<?php echo U('edit?id='.$v['id']); ?>">修改</a>
                    <a onclick="return confirm('确定要删除吗？')" href="<?php echo U('delete?id='.$v['id']); ?>">删除</a>
                </td>
            </tr>
            <?php endforeach;?>
        </table>

        <!-- 分页开始 -->
        <table id="page-table" cellspacing="0">
            <tr>
                <td width="80%">&nbsp;</td>
                <td align="center" nowrap="true">
                    <?php echo $page;?>
                </td>
            </tr>
        </table>
        <!-- 分页结束 -->
    </div>
</form>

<!--引入Jquery-->
<script type="text/javascript" src="__PUBLIC__/umeditor1_2_2-utf8-php/third-party/jquery.min.js"></script>
<!--添加时间插件-->
<link href="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/datepicker-zh_cn.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.css" />
<script type="text/javascript" src="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/datetimepicker/time/i18n/jquery-ui-timepicker-addon-i18n.min.js"></script>
<!--引入高亮显示行-->
<script type="text/javascript" src="__PUBLIC__/Admin/Js/tron.js"></script>
<script>
    $.timepicker.setDefaults($.timepicker.regional['zh-CN']);
    $("#fa").datetimepicker();
    $("#ta").datetimepicker();
</script>